package com.stu.action;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.stu.model.Stu;
import com.stu.service.StuService;
import com.stu.service.impl.StuServiceImpl;

/**
 * Servlet implementation class StuViewAction
 */
@WebServlet("/StuViewAction")
public class StuViewAction extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
   
    public StuViewAction() {
        super();
    }

	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		StuService service=StuServiceImpl.getStuServiceImpl();
		List<Stu> list=service.findAll();
		request.setAttribute("list", list);
		request.getRequestDispatcher("index/view.jsp")
		.forward(request, response);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
